﻿@{
    Uri url = this.WorkContext.HttpContext.Request.Url;
    string host = "http://" + url.Host;
    string bingUrl = "http://www.microsofttranslator.com/bv.aspx?a=" + HttpUtility.UrlEncode(host);

    // To support version 1.0 and 1.0.1 of ATTools (upgrades)
    string widthString = Model.Width.ToString();
    int anInt;
    if (Int32.TryParse(widthString, out anInt))
    {
        widthString = widthString + "px";
    }
}        

<div id="MicrosoftTranslatorWidget" style="width: @{@widthString}; min-height: 57px; border-color: @Model.BorderColor;
    background-color: @Model.Color;">
    <noscript>
        <a href="@bingUrl">Translate
            this page</a><br />
        Powered by <a href="http://www.microsofttranslator.com">Microsoft® Translator</a></noscript></div>
<script type="text/javascript"> /* <![CDATA[ */ setTimeout(function() { var s = document.createElement("script"); s.type = "text/javascript"; s.charset = "UTF-8"; s.src = ((location && location.href && location.href.indexOf('https') == 0) ? "https://ssl.microsofttranslator.com" : "http://www.microsofttranslator.com" ) + "/ajax/v2/widget.aspx?mode=manual&from=en&layout=ts"; var p = document.getElementsByTagName('head')[0] || document.documentElement; p.insertBefore(s, p.firstChild); }, 0); /* ]]> */ </script>